package com.fileFormatConvert;

public enum ImageFormat {
    JPEG("JPEG"),
    PNG("PNG"),
    GIF("GIF"),
    BMP("BMP"),
    TIFF("TIFF");

    private final String formatName;

    ImageFormat(String formatName) {
        this.formatName = formatName;
    }

    public String getFormatName() {
        return formatName;
    }

    // 根据文件后缀判断是否是支持的格式
    public static boolean isValidFormat(String fileExtension) {
        for (ImageFormat format : values()) {
            if (format.name().equalsIgnoreCase(fileExtension)) {
                return true;
            }
        }
        return false;
    }
}
